package com.boss.fileapp.service;

import com.boss.fileapp.controller.CronConfigController;
import com.boss.fileapp.dao.AutoCronDao;
import com.boss.fileapp.schedule.SalaryAutoReportTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class AutoCronService {

    private static Logger logger = LoggerFactory.getLogger(CronConfigController.class);

    @Autowired
    private SalaryAutoReportTask salaryAutoReportTask;

    @Autowired
    private AutoCronDao autoCronDao;

    /**
     * 初始化定时任务
     */
    public void initCronConfig() {
        List<Map<String, Object>> cronList = getEndDay();
        salaryAutoReportTask.initAddCronTask(cronList);
    }

    public List<Map<String, Object>> getEndDay() {
        return autoCronDao.getEndDay();
    }


}
